#ifndef SICBOSQL_H
#define SICBOSQL_H

#include "GameDBInterface.h"
#include "SicBoOptions.h"
#include "CrapConn.h"

class TrackSQL;
struct SicBoBet;

/**********************************************************************************************
* This class handles the work of reading and writing data to the database for the SicBo game.
* All SicBo database traffic should go through here.
*
* kharmon.  06-16-06.  #3077.  Added for SicBo.
***********************************************************************************************/
class SicBoSQL : public GameDBInterface
{
public:
    SicBoSQL(CrapsConnection *pConn, TrackSQL *pSQL);

    virtual ~SicBoSQL() { };

    // The entire set of data for a round of sicbo is written to the database by this call, which 
    // also returns an updated balance that reflects the results of the round.
    bool8 trackRoll(uint8 ucDie1, uint8 ucDie2, uint8 ucDie3, SicBoBet *pBetInfo, 
                    int32 nNumBets, int32 nTotalBet, int32 nTotalPayout, 
                    int32 nBalAdjust, int32 *balance);


    // loads the table limits for sicbo
    virtual bool8 trackLoadOptions();

    // sicbo doesn't have any saved games, but we have to implement this pure virtual function from the base.
    virtual bool8 trackHasSavedGame(DiceGame *& pGame, int32 *err);

    // simple accessor to get to the loaded table limit data.
    SicBoOptions * getOptions();

#ifdef DEBUG_KNOWNROLLS
// Testing logic.  Loads in spins from debug table.
    void getDebugRoll(uint8 *pucDie1, uint8 *pucDie2, uint8 *pucDie3);

    static bool8 bLoaded;
    static uint8 aucDice[255][3];
    static int32 nMaxRoll;
    static int32 nCurrRoll;
#endif

private:

    // this does the actual work of saving a sicbo round to the database
    int32 roll(CrapsConnection::Info *pGameInfo, uint8 ucDie1, uint8 ucDie2, uint8 ucDie3, 
               SicBoBet *pBetInfo, int32 nNumBets, int32 nTotalBet, 
               int32 nTotalPayout, int32 nBalAdjust, int32 *pnBalance);

    // we keep this around for when people ask for it.
    SicBoOptions m_options;
    
    
};



#endif